package com.example.yunpicturebackend.common;

import com.example.yunpicturebackend.exception.ErrorCode;
import lombok.Data;

import java.io.Serializable;

/**
 * @author Yan.z.h
 * @version 1.0
 */

/**
 * 通用返回类
 * @param <T>
 */
@Data
public class BaseResponse<T> implements Serializable {

    private static final long serialVersionUID = -6630308414242143019L;
    private  int status;
    private  T  data;
    private String message;


    public BaseResponse(int status, T data, String message) {
        this.status = status;
        this.data = data;
        this.message = message;

    }



    public BaseResponse(int status, T data) {
        this(status,data,"");

    }

    public BaseResponse(ErrorCode errorCode){
        this(errorCode.getCode(),null,errorCode.getMessages());
    }


//    public BaseResponse(ErrorCode errorCode, String description) {
//        this(errorCode.getCode(),null,errorCode.getMessage(),description);
//    }
//
//    public BaseResponse(ErrorCode errorCode,String message, String description) {
//        this(errorCode.getCode(),null,message,description);
//    }
}
